<template>
  <div class="affix-demo" style="margin: 20px 0;">
    <div v-height="300" class="bg-gray3-color relative">
      <d-affix :offset-bottom="10" :offset-top="220" @change="onchange">
        <button class="d-btn" :class="{'d-btn-red': fixed}">
          固定在距离底部偏移量10px的位置
        </button>
      </d-affix>
    </div>
  </div>
</template>

<script>
export default {
  name: 'demo2',
  data () {
    return {
      fixed: false
    }
  },
  methods: {
    onchange (fixed) {
      this.fixed = fixed
    }
  }
}
</script>

<style lang="stylus" scoped>
// .affix-demo
</style>
